<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>九九乘法表</title>
    <style>
        p {
            width: 100px;
            text-align: left;
            display: inline-block;
            padding: 10px;
            margin: 0px;
            font-size: 18px;
        }

        div {
            display: block;
        }

        #multiplication table{
            width: auto;
            display: inline-block !important;
            display: inline;
        }
    </style>
</head>

<body>
<h1>9*9乘法表</h1>
<div id="multiplication table"></div>
</body>
<script>
    window.onload = function() {
        for(var i = 1; i <= 9; i++) {
            divs = document.getElementById("multiplication table").innerHTML += "<div></div>";
            for(var j = 1; j <= i; j++) {
                document.getElementById("multiplication table").getElementsByTagName("div")[i - 1].innerHTML += "<p>" + j + " * " + i + " = " + (j * i) + "</p>";
            }
        }
    }
</script>
</html>
